﻿@using WebLogic.Model.Tag;
@using Lib.core;
@{
    Layout = null;
    var selectedtaglist = ViewData["selectedtaglist"] as List<string>;
    if (selectedtaglist == null) { selectedtaglist = new List<string>(); }

    var taglist = ViewData["taglist"] as List<TagModel>;
}

<script src="~/ui/jq-plus/tagEditor/jquery.tag-editor.min.js"></script>
<link href="~/ui/jq-plus/tagEditor/jquery.tag-editor.css" rel="stylesheet" />

<div class="tag_input_con">
    <textarea class="tag_input" name="tag_input"></textarea>
</div>

<script type="text/javascript">
    var tag_input = null;
    $(function () {

        var tags = [@(Html.Raw(ViewData["tags"]))];
        if (tags.length > 0) {
            tags = tags[0];
        }

        tag_input = $('.tag_input').tagEditor({
            initialTags: tags,
            maxTags: 3,
            maxLength: 10,
            forceLowercase: false,
            placeholder: '输入标签...'
        });

    });
    function GetSelectedTags() {
        if (tag_input == null) { return ''; }
        return tag_input.tagEditor('getTags')[0].tags.join(',');
    }
</script>